"""luffyapi URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
# 注意此时我们已经更换了默认分配置文件settings.py  但是我们导入的settings也会自动更改为新的配置文件
# 原因自己顺着导入的这个settings实例 去看的源码
from django.conf import settings

import xadmin
xadmin.autodiscover()
from xadmin.plugins import xversion

xversion.register_models()


urlpatterns = [
    path('admin/', admin.site.urls),
    path('xadmin/', xadmin.site.urls),
    path('ckeditor/', include('ckeditor_uploader.urls')),  # 富文本编辑器的上传图片的url路径

    path('home/', include('home.urls')),
    path('users/', include('users.urls')),
    path('course/', include('course.urls')),
    path('cart/', include('cart.urls')),
    path('orders/', include('orders.urls')),

] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
